import java.util.Scanner;

public class p1425{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        int start = a * 60 + b;
        int end = c * 60 + d;
        int diff = end - start;

        int e = diff / 60;
        int f = diff % 60;
        System.out.println(e + " " + f);

        sc.close();
    }
}
